package com.davydov.suabl.model;

import java.awt.Image;

import com.davydov.suabl.Position;

public abstract class Character extends PhysicsObject {
	protected int health;
	protected Image avatar;
	protected String name;
	//protected Environment myEnv; no longer the plan

	public Character(int health, int mass, Position pos, Image avatar) {
		super(mass, 0, pos);
		this.health = health;
		this.setAvatar(avatar);
	}
	
	public Image getAvatar() {
		return avatar;
	}

	public void setAvatar(Image avatar) {
		this.avatar = avatar;
	}

	
	public int getHealth() {
		return health;
	}
	
	/* Pre: none
	 * Post: character health is set to the new value. If the new value
	 * 	is 0 or smaller, the character calls die() on himself.
	 */
	public void setHealth(int health, Environment env) {
		this.health = health;
		if(health <= 0)
			this.die(env);			// this.die(env) does not work... and why would you need to pass the env to "this"?
	}
	
	public String getName() {
		return "Generic Character";
	}
	
	//I removed all the environment parameters here because every instance now knows where it is inherently
	abstract void fire(Environment env);
	abstract void die(Environment env);
	//inherits from physics object now
	//abstract void tick(Environment env); //independent AI; generally speaking, will search for opponent characters and attack
}
